import request from '@/utils/request'

/**
 * 创建预约
 */
export function createAppointment(data) {
  return request({
    url: '/appointment/create',
    method: 'post',
    data
  })
}

/**
 * 确认预约
 */
export function confirmAppointment(id) {
  return request({
    url: `/appointment/confirm/${id}`,
    method: 'post'
  })
}

/**
 * 拒绝预约
 */
export function rejectAppointment(id) {
  return request({
    url: `/appointment/reject/${id}`,
    method: 'post'
  })
}

/**
 * 取消预约
 */
export function cancelAppointment(id) {
  return request({
    url: `/appointment/cancel/${id}`,
    method: 'post'
  })
}

/**
 * 开始预约
 */
export function startAppointment(id) {
  return request({
    url: `/appointment/start/${id}`,
    method: 'post'
  })
}

/**
 * 完成预约
 */
export function completeAppointment(id) {
  return request({
    url: `/appointment/complete/${id}`,
    method: 'post'
  })
}

/**
 * 获取我发起的预约
 */
export function getMyRequests(params) {
  return request({
    url: '/appointment/my-requests',
    method: 'get',
    params
  })
}

/**
 * 获取我收到的预约
 */
export function getMyReceived(params) {
  return request({
    url: '/appointment/my-received',
    method: 'get',
    params
  })
}

/**
 * 获取预约详情
 */
export function getAppointmentDetail(id) {
  return request({
    url: `/appointment/detail/${id}`,
    method: 'get'
  })
}

